home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _C9E90F7F45A648909043A523E2927B6D < prev    next >
Encoding:
Text File  |  2004-01-06  |  4.3 KB  |  134 lines

  1. --------------------------------------------------
  2. --   Created By: Petar
  3. --   Description: Cover goes into this behaviour when there is no more cover, so he holds his ground
  4. --------------------------
  5.  
  6. AIBehaviour.CoverHold = {
  7.     Name = "CoverHold",
  8.  
  9.  
  10.     ---------------------------------------------
  11.     OnKnownDamage = function ( self, entity, sender)
  12.         -- called when the enemy is damaged
  13.         entity:InsertSubpipe(0,"not_so_random_hide_from",sender.id);
  14. --        entity:InsertSubpipe(0,"pause_shooting");
  15.     end,
  16.  
  17.     ---------------------------------------------
  18.     KEEP_FORMATION = function (self, entity, sender)
  19.         entity:SelectPipe(0,"cover_hideform");
  20.     end,
  21.  
  22.  
  23.     ---------------------------------------------
  24.     OnNoTarget = function( self, entity )
  25.         entity:SelectPipe(0,"confirm_targetloss");
  26.     end,
  27.     ---------------------------------------------
  28.     OnPlayerSeen = function( self, entity, fDistance )
  29.         -- drop beacon and shoot like crazy
  30.         local rnd = random(1,10);
  31.         if (rnd < 2) then 
  32.             NOCOVER:SelectAttack(entity);
  33.         else
  34.             entity:SelectPipe(0,"just_shoot");
  35.             entity:InsertSubpipe(0,"DropBeaconAt");
  36.         end
  37.     end,
  38.     ---------------------------------------------
  39.     OnEnemyMemory = function( self, entity, fDistance )
  40.         -- try to re-establish contact
  41.         entity:SelectPipe(0,"seek_target");
  42.         entity:InsertSubpipe(0,"reload");
  43.  
  44.         if (fDistance > 10) then 
  45.             entity:InsertSubpipe(0,"do_it_running");
  46.         else
  47.             entity:InsertSubpipe(0,"do_it_walking");
  48.         end
  49.                 
  50.     end,
  51.     ---------------------------------------------
  52.     OnInterestingSoundHeard = function( self, entity )
  53.         entity:SelectPipe(0,"seek_target");
  54.     end,
  55.     ---------------------------------------------
  56.     OnThreateningSoundHeard = function( self, entity )
  57.         -- ignore this
  58.     end,
  59.     ---------------------------------------------
  60.     OnReload = function( self, entity )
  61.  
  62.     end,
  63.     ---------------------------------------------
  64.     OnGroupMemberDied = function( self, entity )
  65.     end,
  66.     --------------------------------------------------
  67.     OnGroupMemberDiedNearest = function ( self, entity, sender)
  68.         
  69.         AIBehaviour.DEFAULT:OnGroupMemberDiedNearest(entity,sender);    
  70.     
  71.         -- PETAR : Cover in attack should not care who died or not. He is too busy 
  72.         -- watching over his own ass :)
  73.     
  74.     end,
  75.     ---------------------------------------------
  76.     OnNoHidingPlace = function( self, entity, sender )
  77.         -- he is not trying to hide in this behaviour
  78.     end,    
  79.     ---------------------------------------------
  80.     OnReceivingDamage = function ( self, entity, sender)
  81.         -- called when the enemy is damaged
  82.         AIBehaviour.DEFAULT:OnReceivingDamage(entity,sender);
  83.  
  84.         entity:SelectPipe(0,"cover_scramble");
  85.         entity:InsertSubpipe(0,"pause_shooting");
  86.     end,
  87.     ---------------------------------------------
  88.     OnCoverRequested = function ( self, entity, sender)
  89.         -- called when the enemy is damaged
  90.     end,
  91.     --------------------------------------------------
  92.     OnBulletRain = function ( self, entity, sender)
  93.     end,
  94.     --------------------------------------------------
  95.     OnClipNearlyEmpty = function ( self, entity, sender)
  96.         entity:SelectPipe(0,"cover_scramble");
  97.         entity:InsertSubpipe(0,"take_cover");
  98.     end,
  99.     --------------------------------------------------
  100.     -- CUSTOM SIGNALS
  101.     --------------------------------------------------
  102.     COVER_NORMALATTACK = function (self, entity, sender)
  103.         entity:SelectPipe(0,"cover_pindown");
  104.     end,
  105.     ---------------------------------------------
  106.     HEADS_UP_GUYS = function (self, entity, sender)
  107.         -- do nothing on this signal
  108.         entity.RunToTrigger = 1;
  109.     end,
  110.     ---------------------------------------------
  111.     INCOMING_FIRE = function (self, entity, sender)
  112.         -- do nothing on this signal
  113.     end,
  114.     ---------------------------------------------
  115.     LOOK_FOR_TARGET = function (self, entity, sender)
  116.         -- do nothing on this signal
  117.         entity:SelectPipe(0,"look_around");
  118.     end,    
  119.  
  120.     ---------------------------------------------    
  121.     PHASE_BLACK_ATTACK = function (self, entity, sender)
  122.         -- team leader instructs black team to attack
  123.         entity.Covering = nil;
  124.         entity:SelectPipe(0,"black_cover_pindown");
  125.     end,
  126.  
  127.     ---------------------------------------------    
  128.     PHASE_RED_ATTACK = function (self, entity, sender)
  129.         -- team leader instructs red team to attack
  130.         entity.Covering = nil;
  131.         entity:SelectPipe(0,"red_cover_pindown");
  132.     end,
  133.  
  134. }